package com.kedi.welfarecenter.write.dao.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface WriteCommunityPenSecurityMapper {
    /**
     * 方法实现说明  创建福利事项  type =1
     * @Description:
     * @param welfaretitle
     * @param lowage
     * @param heighage
     * @param name
     * @param price
     * @param givetime
     * @return
     */
    @Insert("insert into welfare (welfare_title,low_age,heigh_age,name,price,givetime,status,type) values(#{welfare_title},#{low_age},#{heigh_age},#{name},#{price},#{givetime},0,1)")
    Integer createcps(@Param("welfare_title")String welfaretitle, @Param("low_age")Integer lowage, @Param("heigh_age")Integer heighage, @Param("name")String name, @Param("price")Integer price, @Param("givetime")String givetime);

    /**
     * 方法实现说明 社区保障修改数据  type默认为1  根据主键id 修改
     * @Description:
     * @param welfaretitle
     * @param lowage
     * @param heighage
     * @param name
     * @param price
     * @param givetime
     * @param welfareid
     * @return
     */
    @Update(" update welfare SET welfare_title=#{welfare_title},low_age=#{low_age},heigh_age=#{heigh_age},name=#{name},price=#{price},givetime=#{givetime} where welfare_id=#{welfare_id}")
    Integer updatecps(@Param("welfare_title")String welfaretitle, @Param("low_age")Integer lowage, @Param("heigh_age")Integer heighage, @Param("name")String name, @Param("price")Integer price, @Param("givetime")String givetime, @Param("welfare_id")Integer welfareid);

    /**
     * 方法实现说明   根据福利id  插入领取人信息
     * @Description:
     * @param welfareid
     * @param welfarereceiver
     * @param idcard
     * @param receivtime
     * @param phone
     * @return
     */
    @Insert("insert into welfare_receiver (welfare_id,welfare_receiver,idcard,receiv_time,phone) \n" +
            "values(#{welfare_id},#{welfare_receiver},#{idcard},#{receiv_time},#{phone}) ")
    Integer createwelfarereceiver(@Param("welfare_id")Integer welfareid,@Param("welfare_receiver")String welfarereceiver,
                                  @Param("idcard")String idcard,@Param("receiv_time")String receivtime,@Param("phone")String phone);

}
